<template>
 <div>
<cu-custom bgColor="bg-gradual-blue" :isBack="true">
			<block slot="backText">返回</block>
			<block slot="content">全部试题</block>
		</cu-custom>
		<view class="cu-bar bg-white solid-bottom margin-top flex align-items:center" v-for="item in examlist" :key="item.id">
			<view class="cu-item">
				    <button class="cu-btn  bg-white">
					<text class="text-grey">{{item.title}}</text>
					</button>
					<text class="text-blue flex align-items:center">分类:{{item.subjectname}}</text>		
					<button class="cu-btn  bg-glay flex" @click="GoExamListInfo(item.id)">
					<text class="text-grey">查看详情</text>
					</button>
					
			</view>	
		</view>
		
		
		
 </div>
</template>

<script>
//对外暴露接口
 export default {
   data () {
     return {
		 examlist:[
         {
		 id:1,
         title:"测试用数据0",
         subjectid:1,
         scorce:2,
         optiona:"测试用选项A",
         optionb:"测试用选项B",
         optionc:"测试用选项C",
         optiond:"测试用选项D",
         difficulty:3,
         answer:"测试用答案",
         parse:"测试用解析",
		 subjectname: "物联网概论",



         },
          {
	     id:2,
         title:"测试用数据1",
         subjectid:0,
         scorce:2,
         optiona:"测试用选项A",
         optionb:"测试用选项B",
         optionc:"测试用选项C",
         optiond:"测试用选项D",
         difficulty:3,
         answer:"测试用答案",
         parse:"测试用解析",
		 subjectname: "物联网概论",



         }],

     }
   },
   components: {

   },
   created() {
	   this.GetExamList();
   },
   methods:{
	   GoExamListInfo(id){
		   //根据id跳转界面
		   uni.navigateTo({
		   	url:"/pages/mypages/examinfo/examinfo?id="+id
		   })
	   },
	   //获取所有信息
	   GetExamList(){
		   let that = this
		   let data = {
			   
		   }
		   uni.request({
		   url:"http://localhost/stuapi/StuGetExamlist",
		   data:data,
		   method:"POST",
		   header:{'content-type':'application/x-www-form-urlencoded'},
		   success: (res) => {
		   let code = res.data.code;
		   
		   console.log(res.data);
		   if(code == 200){
			   that.examlist = res.data.data
		   }
		   else{
		   }
		   uni.showToast({ title:res.data.message, icon:"none",})
		   }
		    });
	   }
	   
   }
 }
</script>

<style scoped>

 
</style>
